@import '../../assets/css/theme.scss';
@import '../../assets/css/im.scss';

.im {
  display: flex;
  flex-direction: row;
  width: 500px;
  height: 500px;

  .left-bar {
    background-color: #1c2438;
    width: 6rem;
    height: 100%;

    ul {
      margin: 3rem 1.2rem 1.2rem 1.2rem;
      list-style: none;

      li {
        -webkit-app-region: no-drag;
        display: block;
        width: 3.6rem;
        height: 3.6rem;
        text-align: center;
        margin-bottom: 2rem;
        cursor: pointer;

        .ivu-icon {
          font-size: 3rem !important;
          color: $color-default;
          margin: 0.3rem;
          cursor: pointer;

          &:hover {
            color: $color-write;
          }
        }

        .router-link-active {
          .ivu-icon {
            color: $color-write;
          }
        }
      }

      .userPhoto {
        margin-bottom: 2rem;

        img {
          width: 3.6rem;
          height: 3.6rem;
        }
      }
    }
  }

  .content {
    flex: 1;
  }
}

.ivu-tabs-content {
  height: 100%;
}

.chat-panel {
  // width: 26rem;
  width: 100%;
  background-color: $color-light-gray;
  height: 100%;
  display: flex;
  flex-direction: row;

  .chat-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .chat-box-list {
    height: 100%;
    width: 22rem;
    display: flex;
    flex-direction: column;

    .search-box {
      margin: 1.5rem;
      width: 19rem;
    }
  }
}

.bg-efefef {
  background-color: #efefef;
}

.bg-282830 {
  background-color: #282830;
}

.group-box {
  height: 100%;
  overflow-y: scroll;

  .count {
    color: #aaaaaa;
  }

  li {
    list-style: none;
    position: relative;
    font-size: 1.2rem;
    cursor: pointer;
    font-weight: 200;
    margin-bottom: 2rem;

    h5 {
      padding: 0.5rem 0;
      cursor: pointer;
      font-size: 1.3rem;
      font-weight: 200;

      i {
        vertical-align: baseline;
      }
    }

    img {
      width: 4.4rem;
      height: 4.4rem;
      position: absolute;
      top: 0.4rem;
      left: 2rem;
    }

    b {
      position: absolute;
      font-size: 1.3rem;
      left: 7.5rem;
      overflow: hidden;
      text-overflow: ellipsis;
      font-weight: 600;
      top: 0.6rem;
    }

    p {
      position: absolute;
      left: 7.5rem;
      bottom: 0.4rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      width: 75%;
      font-size: 1.1rem;
      color: #aaaaaa;
    }
  }

  .user {
    height: 5.2rem;
    position: relative;

    a {
      display: block;
      width: 100%;
      height: 100%;
      color: $color-default;
      position: relative;

      i {
        display: inline-block;
        width: 1.8rem;
        height: 1.6rem;
        background-color: #ff0000;
        border-radius: 50%;
        color: $color-write;
        text-align: center;
        font-style: normal;
        position: absolute;
        left: 1rem;
        top: 0;
        z-index: 99999999999;
      }

      p {
        width: 12rem;
      }
    }

    &:hover {
      background-color: $color-gray !important;

      &>i {
        color: $color-default;
        background-color: $color-write;
      }
    }

    .active {
      background-color: $color-gray !important;
    }

    &>i {
      position: absolute;
      right: 1rem;
      bottom: 1.6rem;
      cursor: pointer;
      border-radius: 50%;
      padding: 0.2rem;
      text-align: center;
      color: $color-light-gray;

      &:hover {
        color: $color-default;
        background-color: $color-write;
      }
    }
  }
}

.system-msg {
  font-size: 14px;
  color: #bbbbbb;
  text-align: center;
}

.im-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 4rem;
  overflow: hidden;
}

.im-chat-top {
  border-bottom: 1px solid #cccccc;
  color: $color-default;
  padding: 0 0 0.2rem 1rem;
  font-size: 1.6rem;
  font-weight: bold;
  height: 40px;

  .menu {
    color: $color-default;
    display: inline-block;
    padding: 0 10px;
  }
}

.user-model {
  .user-model-img {
    padding: 30px;
    text-align: center;

    img {
      border-radius: 50%;
    }
  }

  .user-model-item {
    display: flex;
    padding: 5px 0;

    label {
      flex: 2;
      font-weight: bold;
      text-align: right;
    }

    span {
      flex: 3;
    }
  }
}

.im-chat-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  height: calc(100% - 40px);

  .im-chat-main-left {
    flex: 4;
    display: flex;
    flex-direction: column;

    .im-chat-main-box {
      flex: 1;
      padding-top: 1rem;
      overflow-x: hidden;
      overflow-y: auto;
    }
  }

  .message-img {
    max-width: 20rem;
  }

  .im-chat-users {
    flex: 1;
    border-left: 1px solid #cccccc;
    overflow-y: scroll;
  }

  .messages {
    width: 100%;
    height: calc(100% - 3rem);
    overflow-y: scroll;

    ul {
      width: 100%;

      li {
        position: relative;
        font-size: 0;
        margin-bottom: 10px;
        text-align: left;
        // padding-left: 20px;
        // min-height: 68px;

        .im-chat-text {
          position: relative;
          line-height: 16px;
          margin-top: 25px;
          padding: 0.8rem 1.5rem;
          background-color: #FFF;
          border-radius: 3px;
          color: #ffffff;
          word-break: break-all;
          display: inline-block;
          vertical-align: top;
          font-size: 14px;

          &:after {
            content: '';
            position: absolute;
            left: -10px;
            top: 13px;
            width: 0;
            height: 0;
            border-style: solid dashed dashed;
            border-color: #FFF transparent transparent;
            overflow: hidden;
            border-width: 10px;
          }

          pre {
            width: 100%;
            white-space: pre-wrap;
            word-break: break-all;
            color: #000000
          }
        }
      }
    }

    .im-chat-user {
      // width: 4rem;
      height: 4rem;
      position: absolute;
      display: inline-block;
      vertical-align: top;
      font-size: 14px;
      left: 20px;
      right: auto;

      cite {
        width: 500px;
        line-height: 24px;
        font-size: 12px;
        white-space: nowrap;
        color: #999;
        text-align: left;
        font-style: normal;

        i {
          font-style: normal;
          padding-left: 15px;
        }
      }

      img {
        width: 4rem;
        height: 4rem;
        border-radius: 100%;
      }
    }

    .im-chat-mine {
      text-align: right;
      padding-left: 0;
      padding-right: 20px;

      .im-chat-text {
        margin-left: 0;
        text-align: left;
        background-color: #27b8c9;
        color: #fff;
        display: inline-block;
        vertical-align: top;
        font-size: 14px;

        &:after {
          left: auto;
          right: -10px;
          border-top-color: #27b8c9;
        }

        pre {
          color: #FFF
        }
      }

      .im-chat-user {
        left: auto;
        right: 20px;

        cite {
          left: auto;
          right: 20px;
          text-align: right;

          i {
            padding-left: 0;
            padding-right: 15px;
          }
        }
      }
    }
  }
}

.im-chat-footer {
  border-top: 1px solid $color-gray;
  // height: 15rem;
  height: 100px;
  display: flex;
  flex-direction: column;

  .im-chat-tool {
    height: 3.4rem;
    position: relative;
    display: inline-block;
    color: white;

    i {
      font-size: 2.4rem;
      cursor: pointer;
      margin-right: 20px;
    }

    .faces-box {
      position: absolute;
      bottom: 3.8rem;
      margin-left: -195px;
    }

    .ivu-upload {
      display: inline-block;
    }

    .history-message-btn {
      float: right;
    }
  }

  textarea {
    border: 0;
    padding: 0.5rem;
    width: 100%;
    flex: 1;
    resize: none;
    background-color: $color-box-bg !important;

    &:focus {
      border: 0;
    }
  }

  .im-chat-send {
    height: 45px;
    text-align: right;
    padding: 6px;
  }
}

.ivu-scroll-wrapper {
  margin: 0 !important;
}

.ivu-scroll-container {
  padding: 15px 15px 5px;
  overflow-y: visible !important;
}

/* 重新覆盖iview 里面的 model 小于768px 时候 宽度变100% 的问题 */
@media (max-width: 768px) {
  .user-model {
    .ivu-modal {
      width: 30rem !important;
      margin: 0 auto;
    }
  }
}

.history-message {
  width: 80%;
  height: calc(100% - 30px);
}

.page {
  position: fixed;
  bottom: 0;
  width: 100%;
  margin: 0.5rem;
}

.ivu-drawer-body {
  padding: 0 !important;

  .messages {
    height: calc(100% - 3rem);
  }
}

.chat-user-list {
  list-style: none;
  margin: 0;
  padding: 1rem;

  &>li {
    margin-bottom: 1rem;
    cursor: pointer;

    &>.im-chat-avatar {
      width: 3.2rem;
      height: 3.2rem;
      display: inline-block;
      vertical-align: middle;

      &>img {
        width: 100%;
        height: 100%;
      }

    }
  }
}